package com.wang.controller.outer;

import com.wang.domain.UserProfile;
import com.wang.dto.UserProfileDTO;
import com.wang.service.IUserProfileService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wangyandong
 * @date 2020/1/31 22:28
 */
@RestController
@RequestMapping("/outer/user/")
public class UserController {

    @Autowired
    private IUserProfileService userProfileService;

    @GetMapping("/getById/{userId}")
    public UserProfileDTO getById(@PathVariable("userId") Integer userId){
        UserProfile userProfile = userProfileService.getById(userId);
        UserProfileDTO userProfileDTO = new UserProfileDTO();
        BeanUtils.copyProperties(userProfile,userProfileDTO);
        return userProfileDTO;
    }
}
